﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace Instagram_Desktop.UserControls
{
    /// <summary>
    /// Interaction logic for SearchText.xaml
    /// </summary>
    public partial class SearchText : UserControl
    {
        public SearchText()
        {
            InitializeComponent();
        }

        //public string Text
        //{
        //    get => (string)GetValue(TextProperty);
        //    set => SetValue(TextProperty, value);
        //}

        //public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(SearchText));

        private void textblock_MouseDown(object sender, MouseButtonEventArgs e)
        {
            textbox.Focus();
        }

        private void textbox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (!string.IsNullOrEmpty(textbox.Text) && textbox.Text.Length > 0)
            {
                textblock.Visibility = Visibility.Collapsed;
            }
            else
            {
                textblock.Visibility = Visibility.Visible;
            }
        }

    }
}
